package com.zwan.oam_rtc.utils.messages;

import com.zwan.oam_rtc.utils.wintcp.ByteTransfer;

import java.nio.ByteBuffer;

public class CTIBCSMEventMessage extends AbstractStruct {
    private byte[] dwCommand= new byte[4];
    private byte[] strcommand = new byte[512];
    private byte[] ASRendflag = new byte[2];

    private static int LENGTH = 512+6;

    /**
     * 返回消息写入buffer
     */
    @Override
    public void writeToBuffer(ByteBuffer bf) {
        bf.put(dwCommand);
        bf.put(strcommand);
        bf.put(ASRendflag);
    }

    /**
     * buffer读出返回消息
     */
    @Override
    public void readFromBuffer(ByteBuffer bf) {
        bf.get(dwCommand);
        bf.get(strcommand);
        bf.get(ASRendflag);
    }

    public String getDwCommand() {
        return ByteTransfer.getString(dwCommand);
    }
    public void setDwCommand(String dwCommand) {
        ByteTransfer.str2Byte(dwCommand, this.dwCommand);
    }

    public String getStrcommand() {
        return ByteTransfer.getString(strcommand);
    }
    public void setStrcommand(String strcommand) {
        ByteTransfer.str2Byte(strcommand, this.strcommand);
    }

    public String getASRendflag() {
        return ByteTransfer.getString(ASRendflag);
    }
    public void setASRendflag(String ASRendflag) {
        ByteTransfer.str2Byte(ASRendflag, this.ASRendflag);
    }

    @Override
    public int getLength() {
        return LENGTH;
    }
}
